local zhangchong = fk.CreateSkill{
  name = "xiaobai__zhangchong",
  tags = {
    Skill.Compulsory
  }
}

Fk:loadTranslationTable{
  ["xiaobai__zhangchong"] = "彰重",
  [":xiaobai__zhangchong"] = "锁定技，你于回合内使用牌无距离与次数限制；若你本回合造成过两次伤害，你不能使用伤害牌。",

  ["@xiaobai__zhangchong-turn"] = "彰重",
}

zhangchong:addEffect("targetmod", {
  anim_type = "offensive",
  bypass_distances = function (self, player, skill, card, to)
    return player:hasSkill(zhangchong.name) and Fk:currentRoom().current == player
  end,
  bypass_times = function (self, player, skill, card, to)
    return player:hasSkill(zhangchong.name) and Fk:currentRoom().current == player
  end,
})

zhangchong:addEffect(fk.DamageFinished, {
  can_refresh = function (self, event, target, player, data)
    return player:hasSkill(zhangchong.name) and target == player and data.to ~= player
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:addPlayerMark(player, "@xiaobai__zhangchong-turn")
  end
})

zhangchong:addAcquireEffect(function (self, player, is_start)
  if not is_start then
    local room = player.room
    room.logic:getEventsByRule(GameEvent.Damage, 1, function (e)
      if e.data.from and e.data.from == player and e.data.to ~= player then
        room:addPlayerMark(player, "@xiaobai__zhangchong-turn", 1)
      end
    end, 0, Player.HistoryTurn)
  end
end)

zhangchong:addLoseEffect(function (self, player, is_death)
  player.room:setPlayerMark(player, "@xiaobai__zhangchong-turn", 0)
end)

zhangchong:addEffect("prohibit",{
  anim_type = "negative",
  prohibit_use = function (self, player, card)
    return player:hasSkill(zhangchong.name) and card.is_damage_card and player:getMark("@xiaobai__zhangchong-turn") >= 2
  end 
})

return zhangchong